#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
using ll = long long;

ll qui(ll a, ll b)
{
    ll res = 1;
    while(b)
    {
        if(b & 1)res = res * a % MOD;
        b >>= 1;
        a = a * a % MOD;
    }
    return res;
}

int func(int l, int r){
    int n = r - l - 1;
    return (n & 1) ? 1 : (n / 2) + 1;
}

void solve(){
    ll n, k, x;
    cin >> n >> k;
    set<ll> se;
    se.insert(0), se.insert(n + 1);
    ll ans = func(0, n + 1);
    while(k--){
        cin >> x;
        auto p = se.find(x);
        if(p != se.end()){
            ll l = *prev(p);
            ll r = *next(p);
            se.erase(p);
            ans *= func(l, r);
            ans %= MOD;
            ans *= qui(func(l, x), MOD - 2);
            ans %= MOD;
            ans *= qui(func(x, r), MOD - 2);
            ans %= MOD;

        }else{
            p = se.insert(x).first;
            ll l = *prev(p);
            ll r = *next(p);
            ans *= func(l, x);
            ans %= MOD;
            ans *= func(x, r);
            ans %= MOD;
            ans *= qui(func(l, r), MOD - 2);
            ans %=MOD;
        }
        cout << ans << endl;
    }
}

int main(){
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}

